package com.clss.commandhelper.function.caseAddInformation;

import com.clss.commandhelper.base.BaseCallback;
import com.clss.commandhelper.base.BaseJson;
import com.clss.commandhelper.base.BasePresenter;
import com.clss.commandhelper.base.BaseView;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by Administrator on 2017/11/27.
 */

public class CaseAddInformationPresenter extends BasePresenter {

    CaseAddInformationModel mCaseAddInformationModel;
    AddCaseView mAddCaseView;

    public CaseAddInformationPresenter(AddCaseView addCaseView) {
        mAddCaseView = addCaseView;
    }

    public void addCaseInformation(){
        mAddCaseView.showLoadingDialog("正在提交");
        if (mCaseAddInformationModel == null){
            mCaseAddInformationModel = new CaseAddInformationModel(mAddCaseView.getActContext());
        }
        mCaseAddInformationModel.addCaseInfo(mAddCaseView.getAddInfoTask(), new BaseCallback(mAddCaseView) {
            @Override
            public void responseSuccess(BaseJson baseJson) {
                mAddCaseView.addCaseSuccess();
            }
        });
    }

    @Override
    public void cancelCall() {

    }

    interface AddCaseView extends BaseView{
        void addCaseSuccess();
        AddInfoTask getAddInfoTask();
    }
}
